import math
num=2000105819
#超时
def isPerfectSquare(num):
    print(math.ceil(num/2)+1)
    for i in range(1,math.ceil(num/2)+1):
        if int(num)/i==i:
            return True
    return False

def isPerfectSquare1(num):
    i=math.ceil(num/2)+1
    while i>0:
        if int(num)/i==i:
            return True
        i-=1
    return False

def isPerfectSquare2(num):
    sum=0
    i=1
    while sum<num:
        sum+=2*i-1
        i+=1
    if sum==num:
        return True
    else:
        return False

#二分法
def isPerfectSquare3(num):
    l_pointer=1
    r_pointer=num
    while l_pointer<=r_pointer:
        #当该条件成立时，继续进行搜索
        mid_pointer=(l_pointer+r_pointer)>>1
        cur_value=mid_pointer*mid_pointer
        if cur_value==num:
            return True
        elif cur_value>num:
            r_pointer=mid_pointer-1
        else:
            l_pointer=mid_pointer+1
    return False


print(isPerfectSquare3(num))